home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_06 / bsound.asm < prev    next >
Assembly Source File  |  1995-01-01  |  2KB  |  106 lines

  1. ;    SOUNDBAS.ASM
  2. ;
  3. ;    Marc Savary, Editions Ad Lib., 3-06-87
  4. ;
  5. ;    assembler interface to the Sound Driver for Basic programs
  6. ;
  7. ;    This code should be included in a Basic array and used with the CALL
  8. ;    command :    func = VARPTR (array(0)): CALL func(s0,s1,s2, ....)
  9. ;
  10.  
  11.  
  12. sound_driver_int    equ    101            ; SD interrrupt number
  13.  
  14. fSDInit        equ    0
  15. fSDRelTimeStart    equ    2
  16. fSDSetState    equ    3
  17. fSDGetState    equ    4
  18. fSDFlush    equ    5
  19. fSDSetMode    equ    6
  20. fSDGetMode    equ    7
  21. fSDSetRelVolume    equ    8
  22. fSDSetTempo    equ    9
  23. fSDSetTranspose    equ    10
  24. fSDGetTranspose    equ    11
  25. fSDSetActVoice    equ    12
  26. fSDGetActVoice    equ    13
  27. fSDPlayNoteDel    equ    14
  28. fSDPlayNote    equ    15
  29. fSDSetTimbre    equ    16
  30. fSDSetPitch    equ    17
  31. fSDSetTickBeat    equ    18
  32. fSDNoteOn    equ    19
  33. fSDNoteOff    equ    20
  34. fSDTimbre    equ    21
  35.  
  36.  
  37. Code    SEGMENT    BYTE
  38.     assume cs:code
  39.         
  40.  
  41. ;    SoundBasic( s0, s1, s2, s3, s4, s5)
  42. ;    int * s0, * s1, * s2, * s3, * s4, * s5;
  43. ;
  44. ;    s0:         function number
  45. ;    s1 - s5:    arguments
  46. ;
  47. ;    return result in s0.
  48. ;
  49. SoundBasic PROC FAR
  50.        PUBLIC SoundBasic
  51. frames STRUC
  52.     dw    ?        ; old di
  53.     dw    ?        ; old si
  54. old_es    dw    ?        ; old ES
  55.     dd    ?        ; return addr
  56. s5    dw    ?        ; ptrs to s5 argument
  57. s4    dw    ?        ; ....  s4
  58. s3    dw    ?
  59. s2    dw    ?
  60. s1    dw    ?
  61. s0    dw    ?        ; .. ptr to function number
  62.  
  63. frames ENDS
  64.  
  65.     push    es
  66.     push    si
  67.     push    di
  68.     mov    bp, sp
  69.     mov    bx, [bp].s0
  70.     mov    si, [bx]        ; get function number
  71.     
  72.     mov    bx, [bp].s5
  73.     push    [bx]
  74.     mov    bx, [bp].s4
  75.     push    [bx]
  76.     mov    bx, [bp].s3
  77.     push    [bx]
  78.     mov    bx, [bp].s2
  79.     push    [bx]
  80.     cmp    si, fSDSetTimbre    ; s1 is a pointer ??
  81.     jne    suite
  82.     push    ds            ; we need a Far prt ...
  83.     push    [bp].s1
  84.     jmp    ok
  85. suite:    mov    bx, [bp].s1
  86.     push    [bx]
  87. ok:    push    ss            ; set ES:BX to point to list of arg.
  88.     pop    es
  89.     mov    bx, sp
  90.     int    sound_driver_int
  91.     mov    sp, bp
  92.  
  93.     mov    bx, [bp].s0        ; store return value in S0
  94.     mov    [bx], ax
  95.     pop    di
  96.     pop    si
  97.     pop    es
  98.     ret    12            ; 6 words arguments
  99. SoundBasic ENDP
  100.  
  101.  
  102. Code    ENDS
  103.     END
  104.     
  105.  
  106.